/*
 * @Author: leevan
 * @Date: 2022-02-11 16:41:21
 * @LastEditTime: 2022-02-17 10:25:00
 * @LastEditors: leevan
 * @FilePath: /usermanagecenter/src/service/dataDictionary.service/index.js
 */

import {
    queryAllDic_path,
    queryAllDicChild_path,
    queryDataFiledSubject_path,
    saveDataFiledSubject_path,
    deleteDataFiledSubject_path,
    getDataDetailByDictId_path,
    getDataSubDetailByDictId_path,
    treeSearch_path,
    saveDict_path,
    updateDict_path,
    deleteDict_path,
    dictDetails_path
} from './path';

import {
    POST , GET , PATCH ,DELETE
} from '@/plugins/axios';


/**
*@描述: //查询主题下面的所有字典（树形结构）
*@描述: subid传入值： 1=机构类别 2=行政区划 3=机构类型 4=单位性质  5=单位层级 9=用户类型
*@author:heli
*/
export const queryAllDic = (subId = '')=> {
    return GET(queryAllDic_path() , {subId});
};
//查询父节点下的所有子节点（树形结构）
export const queryAllDicChild = (parentId = '')=> {
    return GET(queryAllDicChild_path() , {parentId});
};
//数据字典科目分页查询
export const queryDataFiledSubject = data => {
    return GET(queryDataFiledSubject_path(),data,{'content-type': 'application/json'})
}
//数据字典科目保存
export const saveDataFiledSubject = data => {
    return POST(saveDataFiledSubject_path(),data,{'content-type': 'application/json'})
}
//数据字典科目修改
export const updateDataFiledSubject = data => {
    return PATCH(saveDataFiledSubject_path(),data,{'content-type': 'application/json'})
}
//数据字典科目删除
export const deleteDataFiledSubject = subId => {
    return DELETE(deleteDataFiledSubject_path(subId))
}
//根据id查询字典详情
export const getDataDetailByDictId = dictId => {
    return GET(getDataDetailByDictId_path(dictId))
};

//根据id查询字典科目详情
export const getDataSubDetailByDictId = subId => {
    return GET(getDataSubDetailByDictId_path(subId))
};
//主题下字典的模糊搜索（树形结构）
export const queryTreeSearch = data => {
    return GET(treeSearch_path(),data,{'content-type': 'application/json'})
}
//字典管理保存
export const saveDict = data => {
    return POST(saveDict_path(),data,{'content-type': 'application/json'})
}
//更新数据字典
export const updateDict = data => {
    return PATCH(updateDict_path(),data,{'content-type': 'application/json'})
}
//数据字典删除
export const deleteDict = dictId => {
    return DELETE(deleteDict_path(dictId))
}
//数据字典详情
export const dictDetails = dictId => {
    return GET(dictDetails_path(dictId))
}